import React, { Component } from 'react';
// 引入子组件
import Children from './../children'
class Index extends Component {
  constructor(props) {
    super(props)
    this.state = {
      pictures: [ // 初始图片
        {
          id: '1',
          name: 'foo1',
          url: 'https://gw.alipayobjects.com/mdn/rms_d212b7/afts/img/A*LlfeSa8N0WgAAAAAAAAAAABkARQnAQ'
        },
        {
          id: '2',
          name: 'foo2',
          url: 'https://gw.alipayobjects.com/mdn/rms_d212b7/afts/img/A*LlfeSa8N0WgAAAAAAAAAAABkARQnAQ'
        },
        {
          id: '3',
          name: 'foo3',
          url: 'https://gw.alipayobjects.com/mdn/rms_d212b7/afts/img/A*LlfeSa8N0WgAAAAAAAAAAABkARQnAQ'
        }
      ]
    }
  }
  fn(val) {
    console.log(val)
  }
  render () {
    return (
      <div className="box">
        <Children
          value = {this.state.pictures}
          onChange = {this.fn.bind(this)}
        />
      </div>
    )
  }
}

export default Index